﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Zorbo;
using Zorbo.Interface;

using Jurassic;
using Jurassic.Library;

using JScript = Javascript.Script;

namespace Javascript.Objects
{
    public class UserRecord : ObjectInstance
    {
        IRecord record;

        internal IRecord Record {
            get { return record; } 
        }

        protected override string InternalClassName {
            get { return "UserRecord"; }
        }


        public UserRecord(JScript script, IRecord record)
            : base(script.Engine) {

            this.record = record;
            this.PopulateFunctions();
        }

        [JSProperty(Name = "guid", IsEnumerable = true)]
        public String Guid {
            get { return record.Guid.ToString(); }
        }

        [JSProperty(Name = "name", IsEnumerable = true)]
        public String Name {
            get { return record.Name; }
        }

        [JSProperty(Name = "trusted", IsEnumerable = true)]
        public bool Trusted {
            get { return record.Trusted; }
            set { record.Trusted = value; }
        }

        [JSProperty(Name = "muzzled", IsEnumerable = true)]
        public bool Muzzled {
            get { return record.Muzzled; }
            set { record.Muzzled = value; }
        }

        [JSProperty(Name = "dnsName", IsEnumerable = true)]
        public String DnsName {
            get { return record.DnsName; }
        }

        [JSProperty(Name = "externalIp", IsEnumerable = true)]
        public String ExternalIp {
            get { return record.ExternalIp.ToString(); }
        }
    }
}
